#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <queue>

void backtrack(std::vector<char> &a, int n, int left_paren, int right_paren){
	if(left_paren == n && right_paren == n) {
		std::copy(a.begin(), a.end(), std::ostream_iterator<char>(std::cout));
		std::cout << std::endl;
	}
	else {
		std::queue<char> candidates;
		if(left_paren == right_paren) {
			candidates.push('(');
		}
		else if (left_paren != n){
			candidates.push('(');
			candidates.push(')');
		}
		else {
			candidates.push(')');
		}
		while(!candidates.empty()) {
			char c = candidates.front();
			candidates.pop();
			a[left_paren+right_paren] = c;
			if(c == '(')
				backtrack(a,n,left_paren+1,right_paren);
			else
				backtrack(a,n,left_paren,right_paren+1);
		}
	}
}

void test_9_6(){
	int n;
	while(std::cin>>n){
		std::vector<char> a(n+n);
		backtrack(a,n,0,0);
	}
}